<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class AdminUserSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $datas = [
            [
                'username'   => 'admin',
                'password'   => '$2y$10$8D1HwsmYqznBVw35cVvewurBt/xWBly4ct76EWNInIjKssQpFB2sK',
                'name'       => '系统管理员',
                'status'     => 10,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ],
            [
                'username'   => 'permissionAdmin',
                'password'   => '$2y$10$Qp89FtyjfK8Pz2SF0aHjd.Da0cGAPkXqU8HSLiOtUETXkOj9PluIm',
                'name'       => '权限管理员',
                'status'     => 10,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
            ]
        ];
        DB::transaction(function () use ($datas) {
            foreach ($datas as $data) {
                DB::table('admin_users')->insert($data);
            }
        });
    }
}
